package com.liwu.base.spring.test.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

/**
 * @author: liwu
 * @version: 1.0.0
 * @email: <a href="mailto:liwu@pingpongx.com">联系作者</a>
 * @date: 2018/2/3 - 下午4:34
 */

@Aspect
public class Audience {

    @Pointcut("execution(* com.liwu.base.spring.test.aop.inter.Performance.perform(..))")
    public void remark(){

    }

    @Before("remark()")
    public   void  test1(){

        System.out.println(" Audience :Before");
    }

    @After("remark()")
    public   void  test2(){

        System.out.println("Audience: After");

    }
    @AfterReturning("remark()")
    public   void  test3(){

        System.out.println("Audience: AfterReturning");

    }
    @AfterThrowing("remark()")
    public   void  test4(){

        System.out.println("Audience: AfterThrowing");

    }

    @Around("remark()")
    public void  test5(ProceedingJoinPoint jp) throws Throwable {

        System.out.println("Audience:Around--before");
        jp.proceed();
        System.out.println("Audience:Around--after");

    }


}
